<template>
	<view class="annDetail-container">
		<view class="title" style="text-align: center;">
			{{anno.title}}
		</view>
		<view class="content">
			<mp-html :content="anno.content" />
		</view>
		<view class="end">
			<view class="top">
				{{anno.publisher}}
			</view>
			<view class="bottom">
				{{anno.time}}
			</view>
		</view>
		<view class="line"><view></view></view>
		<view class="readNumber">{{readNum}}人已读</view>
		<view class="noMore">
			没有更多了
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				anno:{
					id:'',
					depName:'',
					staffName:'',
					title:'',
					content:'',
					createTime:'',
				},
				readNum: 0
			};
		},
		onLoad(opt) {
			//console.log(opt.id);
			this.getAnno(opt.id);
			this.addReadNum(opt.id);
		},
		methods:{
			getAnno(id){
				this.$myReq({
					url:'/advice/api/get/'+id
				})
				.then((res) => {
					//console.log(res.data);
					this.anno = res.data
				})
			},
			// 查询该公告阅读数量
			addReadNum(id){
				this.$myReq({
					url:'/advice/api/addReadNum',
					method: 'post',
					data: {
						adviceId: id
					}
				})
				.then((res) => {
					//console.log(res.data);
					this.readNum = res.data;
					//console.log(this.readNum);
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: $main-garyA;
	}
	.annDetail-container{
		
		view{
			// border: 1px solid red;
			background-color: #FFFFFF;
			
		}
		.title{
			padding: 30rpx 40rpx 0rpx 40rpx;
			font-size: 40rpx;
			font-weight: bold;
			line-height: 60rpx;
			padding-bottom: 10rpx;
		}
		.content{
			padding: 0rpx 40rpx 0rpx 40rpx;
			padding-bottom: 30rpx;
		}
		.end{
			padding: 30rpx 40rpx 0rpx 40rpx;
			text-align: right;
			.top{
				margin-bottom: 10rpx;
			}
		}
		.line{
			// width: 100%;
			padding: 40rpx 40rpx 50rpx 40rpx;
			view{
				border: 1rpx solid $main-garyB;
			}
		}
		.readNumber{
			padding: 30rpx 40rpx 30rpx 40rpx;
			font-size: 30rpx;
			color: $main-garyB;
		}
		.noMore{
			background-color: $main-garyA;
			text-align: center;
			padding-top: 40rpx;
			color: $main-garyB;
		}
	}
</style>
